                                
                                                    
insert into  asm_morosi_poste_excel
       select so.sog_id utente,'Soggetto in fallimento' note from 
     
             soggetto so
       where 
          so.az_id='01'
     
        and so.sog_id not in (select sog_id from asm_morosi_poste)
       -- and so.sog_id = 8851683
        AND so.sog_id not in (select utente from asm_morosi_poste_excel)
        AND so.sog_id not in (select SOG_ID from asm_morosi_poste_2)
        
        and  so.sog_id  in (select sog_id from v_ragfat where az_id='01'  and gf_id in( 200,105)
        and sta_idsys= 2 and ver_dtfine = to_date('31/12/9999','dd/mm/yyyy'))
        union
        select distinct sog_id,'Soggetto con rate non nei limiti'
        from asm_morosi_poste_2
        where stato = 'IMP NON NEI LIMITI'
                
                                                    

               